---
layout: "default"
title: "maxElement"
description: "Swift documentation for 'maxElement': Returns the maximum element in elements.  Requires:."
keywords: "maxElement,func,swift,documentation"
root: "/v1.2"
---

<div class="declaration" id="func-maxelement-r_-sequencetype-where-r-generator-element_-comparable_-r">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-maxelement-r_-sequencetype-where-r-generator-element_-comparable_-r">func <wbr>maxElement&lt;R :<wbr> SequenceType where R.Generator.Element : Comparable&gt;(<wbr>_: R)</a>
        
<div class="comment collapse" id="comment-func-maxelement-r_-sequencetype-where-r-generator-element_-comparable_-r"><div class="p">
    <p>Returns the maximum element in <code>elements</code>.  Requires:
<code>elements</code> is non-empty. O(count(elements))</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func maxElement&lt;R : SequenceType where R.Generator.Element : Comparable&gt;(elements: R) -&gt; R.Generator.Element</code>
    
    
</div></div>
</div>
